package org.looom.orglooomschool

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.looom.orglooomschool.ui.theme.OrglooomschoolTheme

class MainActivity : ComponentActivity() {
    @OptIn(ExperimentalLayoutApi::class)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContent {
            OrglooomschoolTheme {
                FlowRow {
                    BTN("播放器", Play::class.java)
                    BTN("计算器", Calc::class.java)
                    BTN("三按钮", ChangeButtonTextActivity::class.java)
                    BTN("成绩查询", MainActivity2::class.java)
                    BTN("QQ登录", MainActivity3::class.java)
                    BTN("注册页", Sign::class.java)
                    BTN("登录页", Login::class.java)
                    BTN("点单", MainActivity4diandan::class.java)
                    BTN("数据存储", MainActivity5::class.java)
                    BTN("数据共享-首页", Main_sharedata1::class.java)
                    BTN("数据共享-内部存储", Main_sharedata2::class.java)
                    BTN("通讯录", MainActivity6::class.java)
                    BTN("跨程序共享数据", MainActivity7::class.java)
                    BTN("广播实验", MainActivity14::class.java)
                    BTN("服务播放音乐", MainActivity15::class.java)
                    BTN("广播", MainActivity8::class.java)
                    BTN("仿网易音乐播放器", MainActivity9::class.java)
                }
            }
        }
    }

    @Composable
    fun BTN(name: String, cls: Class<*>) {
        Button(modifier = Modifier.padding(5.dp), onClick = {
            startActivity(Intent(this@MainActivity, cls))
        }) {
            Text(text = name)
        }
    }
}